<template>
  <div class="right-wrapper">
    <div class="right-top-wrapper">
      <div class="top-title">热门阅读</div>
      <ul class="leader-board">
        <li class="board-item" v-for="(item, index) in rankList" :key="index">
          <span :class="['iconfont', board(index)]" :data-index="index + 1"></span>
          <div class="board-info-wrapper">
            <div class="board-content">{{item.content}}</div>
            <div class="board-info">
              <span class="board-author">{{item.author}}</span>
              <span class="iconfont board-reading">&#xe70c;{{item.reading}}</span>
            </div>
          </div>
        </li>
      </ul>
    </div>
    <chat-list></chat-list>
    <commend-blog></commend-blog>
  </div>
</template>

<script>
  import ChatList from '../../../base/chat-list/ChatList'
  import CommendBlog from '../../../base/commend-blog/CommendBlog'
  export default {
    data () {
      return {
        rankList: [
          {
            content: '太厉害了，终于有人能把TCP/IP 协议讲的明明白白了',
            author: '夏日的风',
            reading: '129415'
          },{
            content: '微信小程序开发游戏教程微（附详细资料）',
            author: '云开发创作者',
            reading: '123468'
          }, {
            content: '看电影学编程：人理解迭代，神理解递归',
            author: '网易互娱',
            reading: '23765'
          }, {
            content: '前端技术变革：前端设计模式演变',
            author: 'CSDN社区',
            reading: '13765'
          }, {
            content: '华为云TechWave全球技术峰会',
            author: 'CSDN社区',
            reading: '13625'
          }, {
            content: 'Unity3D的自学之路',
            author: '云开发创作者',
            reading: '13611'
          }, {
            content: '全国大学生计算机系统能力大赛',
            author: '云开发创作者',
            reading: '13599'
          }, {
            content: '为什么Windows比Mac更容易中毒',
            author: '高校俱乐部',
            reading: '13499'
          },
        ]
      }
    },
    methods: {
      board (index) {
        if (index < 3) {
          return `icon-paihangban${index+1}`
        }
        return 'number'
      },
    },
    components: {
      ChatList,
      CommendBlog
    }
  }
</script>

<style scoped lang="scss">
  @import "../../../common/scss/variable";
  @import "../../../common/scss/mixin";
  .right-wrapper {
    max-width: 359px;
    height: 100%;
    overflow: hidden;
    .right-top-wrapper {
      border: 1px solid $border-color;
      .top-title {
        position: relative;
        height: 50px;
        line-height: 50px;
        padding-left: 20px;
        font-weight: 700;
        font-size: 24px;
        color: $font-gray;
        user-select: none;
        border-bottom: 1px solid $border-color;
        &::before {
          content: '';
          position: absolute;
          left: -1px;
          top: 50%;
          width: 3px;
          height: 30px;
          margin-top: -15px;
          line-height: 20px;
          background-color: rgba(237, 12, 12, 100);
          color: $font-gray;
        }
      }
      .leader-board {
        padding: 14px 24px 24px 25px;
        box-sizing: border-box;
        .board-item {
          display: flex;
          align-items: center;
          max-width: 300px;
          cursor: pointer;
          & > .iconfont {
            width: 27px;
            height: 27px;
            line-height: 27px;
            font-size: 27px;
            text-align: center;
          }
          & + .board-item {
            margin-top: 24px;
          }
          .number:before {
            content: attr(data-index);
          }
          .board-info-wrapper {
            display: flex;
            flex-direction: column;
            margin-left: 18px;
            width: calc(100% - 55px);
            .board-content {
              @include no-wrap;
              color: rgb(44, 43, 43);
              font-size: 12px;
            }
            .board-info {
              display: flex;
              align-items: center;
              justify-content: space-between;
              margin-top: 6px;
              font-size: 8px;
              color: rgb(110, 110, 110);
              .board-reading {
                font-size: 8px;
              }
            }
          }
        }
      }
    }
  }
</style>
